home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / trial / demon / TURNPIKE.1 / CLASSES.ZIP / sun / AWT / IMAGE / FileImageSource.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-14  |  1.4 KB  |  50 lines

  1. package sun.awt.image;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.FileInputStream;
  5. import java.io.FileNotFoundException;
  6.  
  7. public class FileImageSource extends InputStreamImageSource {
  8.    String imagefile;
  9.  
  10.    public FileImageSource(String var1) {
  11.       SecurityManager var2 = System.getSecurityManager();
  12.       if (var2 != null) {
  13.          var2.checkRead(var1);
  14.       }
  15.  
  16.       this.imagefile = var1;
  17.    }
  18.  
  19.    final boolean checkSecurity(Object var1, boolean var2) {
  20.       return true;
  21.    }
  22.  
  23.    protected ImageDecoder getDecoder() {
  24.       BufferedInputStream var1;
  25.       try {
  26.          var1 = new BufferedInputStream(new FileInputStream(this.imagefile));
  27.       } catch (FileNotFoundException var4) {
  28.          return null;
  29.       }
  30.  
  31.       int var2 = this.imagefile.lastIndexOf(46);
  32.       if (var2 >= 0) {
  33.          String var3 = this.imagefile.substring(var2 + 1).toLowerCase();
  34.          if (var3.equals("gif")) {
  35.             return new GifImageDecoder(this, var1);
  36.          }
  37.  
  38.          if (var3.equals("jpeg") || var3.equals("jpg") || var3.equals("jpe") || var3.equals("jfif")) {
  39.             return new JPEGImageDecoder(this, var1);
  40.          }
  41.  
  42.          if (var3.equals("xbm")) {
  43.             return new XbmImageDecoder(this, var1);
  44.          }
  45.       }
  46.  
  47.       return ((InputStreamImageSource)this).getDecoder(var1);
  48.    }
  49. }
  50.